<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">
    <title>修改密码</title>
    <!--引入·外部文件-->
    <div th:include="public/pagehead::head"></div>
    <link th:href="@{/css/stepstyle.css}" rel="stylesheet" type="text/css">
</head>

<body>
<!--头 -->
<header>
    <article>
        <div class="mt-logo">
            <!--顶部导航条 -->
            <div th:include="public/pagehead::common"></div>
            <!--悬浮搜索框-->
            <div th:include="public/pagehead::search"></div>
            <div class="clear"></div>
        </div>
    </article>
</header>
<div class="nav-table">
    <!--全部分类-->
    <div th:include="public/pagehead::category"></div>
</div>
<b class="line"></b>
<div class="center">
    <div class="col-main">
        <div class="main-wrap">

            <div class="am-cf am-padding">
                <div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">修改密码</strong> /
                    <small>Password</small>
                </div>
            </div>
            <hr/>
            <!--进度条-->
            <div class="m-progress">
                <div class="m-progress-list">
							<span class="step-1 step">
                                <em class="u-progress-stage-bg"></em>
                                <i class="u-stage-icon-inner">1<em class="bg"></em></i>
                                <p class="stage-name">重置密码</p>
                            </span>
                    <span class="step-2 step">
                                <em class="u-progress-stage-bg"></em>
                                <i class="u-stage-icon-inner">2<em class="bg"></em></i>
                                <p class="stage-name">完成</p>
                            </span>
                    <span class="u-progress-placeholder"></span>
                </div>
                <div class="u-progress-bar total-steps-2">
                    <div class="u-progress-bar-inner"></div>
                </div>
            </div>
            <form class="am-form am-form-horizontal">
                <div class="am-form-group">
                    <label for="user-old-password" class="am-form-label">原密码</label>
                    <div class="am-form-content">
                        <input type="password" id="user-old-password" placeholder="请输入原登录密码">
                    </div>
                </div>
                <div class="am-form-group">
                    <label for="user-new-password" class="am-form-label">新密码</label>
                    <div class="am-form-content">
                        <input type="password" id="user-new-password" placeholder="由数字、字母组合">
                    </div>
                </div>
                <div class="am-form-group">
                    <label for="user-confirm-password" class="am-form-label">确认密码</label>
                    <div class="am-form-content">
                        <input type="password" id="user-confirm-password" placeholder="请再次输入上面的密码">
                    </div>
                </div>
                <div class="info-btn">
                    <div class="am-btn am-btn-danger">保存修改</div>
                </div>

            </form>

        </div>
        <!--底部-->
        <div th:include="public/pagehead::footer"></div>
    </div>

    <aside th:include="public/pagehead::person" class="menu">
    </aside>
</div>
<script th:src="@{/layuiadmin/layui/layui.all.js}"></script>
<script>
    ;!function () {
        //无需再执行layui.use()方法加载模块，直接使用即可
        var form = layui.form
            , layer = layui.layer;
        var $ = layui.$
            , admin = layui.admin
            , element = layui.element
            , layer = layui.layer
            , laydate = layui.laydate
            , form = layui.form;
        form.render();
        laydate.render();
        //提交表单
        $('.am-btn-danger').click(function () {
            var oldPwd = $('#user-old-password').val() //获取原密码
            var newPwd = $('#user-new-password').val()//新密码
            var confirmPwd = $('#user-confirm-password').val() //确认密码
            console.log(oldPwd + newPwd + confirmPwd)
            if (oldPwd == '' || newPwd == '' || confirmPwd == '') {
                layer.msg('不能为空')
            } else if (newPwd == confirmPwd) {
                $.ajax({
                    type: 'post',
                    url: 'repasswd',
                    data: {repassword: newPwd, password: oldPwd},
                    //dataType: 'json',
                    //contentType: 'application/json',
                    success: function (res) {
                        if (res.code == 1) {
                            layer.msg(res.msg, {icon: 6}, function () {
                                document.location.href = "logout"
                            }, function () {
                                window.location.reload()
                            })
                        } else {
                            layer.msg(res.msg, {
                                icon: 5
                            })
                        }
                    }
                })
            } else {
                layer.msg('两次输入密码不一致')
            }
        })
    }();
</script>
</body>

</html>